<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Jialeo\LaravelSchemaExtend\Schema;

class AddExtToFsCompnayUsersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('fs_company_users', function (Blueprint $table) {
            $table->tinyInteger('ext')->default(0)->comment('0:kf本部 1:外部');
        });

        \App\Models\Common\FsCompanyUserModel::query()->where('supplierDepartmentId', '!=', '')->update(['ext' => 1]);
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('fs_company_users', function (Blueprint $table) {
            $table->dropColumn('ext');
        });
    }
}
